
/**
 * Created by Administrator on 2017/11/24 0024.
 */

//日期转换
Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
var WfPowerSk = null;//风电场功率实况表
var WfDq = null;//风电场短期预报数据
var WfNwp = null;//风电场天气预报数据（取风速）
var WfNwpSk = null  //风电场天气预报数据（所有）
var WfMetSk = null;//测风塔数据表（取风速）
var Fan = null;
var WfRmse = null;//获取均方根误差
var WfRmseVal = null;//获取均方根误差值
var startTime = null;       //开始时间，表格导出数据使用
var endTime = null;         //结束时间，表格导出数据使用
var farmName = null;       //电场名称，表格导出数据使用
var fileName = null;
$(function () {
    //$.ajaxSettings.async = false;
    //loadTower();//加载测风塔
    //loadHeight();//加载测风塔高度
    dateTiemSelect();
    $("#query").click(function () {
        // alert("111");
        if($("#startTime").val()===""){
            layer.msg("输入开始时间！", {icon: 2});
            $("#endTime").val("");
        }
        var startTime = new Date($("#startTime").val().replace(/\-/g, "\/"));
        var endTime = new Date($("#endTime").val().replace(/\-/g, "\/"));
        if(startTime >=endTime){
            layer.msg("开始时间不能大于结束时间！", {icon: 2});
            $("#startTime").val("");
            $("#endTime").val("");
            return false;
        }else {
            load();
        }
    })

    var aa = $('#selectFarm', window.parent.document).find("option:selected").text();
    console.log(aa);
    //  fileName = aa.substring(31,aa.length);
    // console.log(fileName);
    startTime = $("#startTime").val();
    endTime = $("#endTime").val();

    var table = new tableFactory(startTime,endTime,aa);
})

//点击时间查询
function dateTiemSelect(){
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#startTime', //新增的日期
            type: 'date',//日期类型date表示年月日
            /*  trigger: 'click',//如果绑定的元素非输入框，则默认事件为：click*/
            theme: '#071f3a',//自定义主题
            min: '2014-1-1',//限制最小日期
            max: '2028-12-31'//限制最大日期
        });
        laydate.render({
            elem: '#endTime', //新增的日期
            type: 'date',
            theme: '#071f3a',//自定义主题
            max: '2028-12-31',//限制最大日期

        });
    });
}

function loadTower(_this){
    var def = $.Deferred();
    $("#tower").empty();//赋值之前，先清空
    var me = this;
    //var index = layer.load(1);
    var farmid = $('#selectFarm', window.parent.document).val();
    var news = $("#tower");//获取测风塔对象
    var data = {"farmid":farmid};
    $.ajax({
        url : "../windCurvesManage/getTower",
        type : "get",
        async:false,
        contentType : "application/json",
        dataType : "json",
        data :data /*JSON.stringify(data)*/,//转换成字符串。后台使用了RequestBody注解
        success : function(data) {
            if(data.listTowerno.length>0){
                for(var i = 0;i<data.listTowerno.length;i++){
                    if(data.listTowerno[i] == data.thisTowerno){
                        news.append('<option value="'+data.listTowerno[i]+'" selected = "selected">'+data.listTowermodel[i]+'</option>');
                    }else {
                        news.append('<option value="'+data.listTowerno[i]+'">'+data.listTowermodel[i]+'</option>');
                    }
                }

            }else {
                news.append('<option value="'+404404404+'">'+'无'+'</option>');
            }


            $("#tower").selectpicker('refresh');
            def.resolve();
            //load();
            //layer.close(index);
        }
    });
    $("#tower").selectpicker();
    return def.promise();
}

//加载测风塔高度
function loadHeight(_this) {
    var def = $.Deferred();
    $("#height").empty();//赋值之前，先清空
    var me = this;
    //var index = layer.load(1);
    var farmid = $('#selectFarm', window.parent.document).val();
    var news = $("#height");//获取测风塔高度对象
    var data = {"farmid":farmid};
    $.ajax({
        url : "../windCurvesManage/getHeight",
        type : "get",
        async:false,
        contentType : "application/json",
        dataType : "json",
        data :data /*JSON.stringify(data)*/,//转换成字符串。后台使用了RequestBody注解
        success : function(data) {
            for(var i = 0;i<data.heightList.length;i++){
                if(data.heightList[i] == data.thisHeight){
                    news.append('<option value="'+data.heightList[i]+'" selected = "selected">'+data.heightList[i]+'米'+'</option>');
                }else {
                    news.append('<option value="'+data.heightList[i]+'">'+data.heightList[i]+'米'+'</option>');
                }
            }

            $("#height").selectpicker('refresh');
            def.resolve();
            //load();
            //layer.close(index);
        }
    });
    $("#height").selectpicker();
    return def.promise();
}

//初始化加载曲线跟表格数据
function load(){
    var index = layer.load(1);
    var date = new Array();//观测时间
    var power =new Array();//实时功率
    var speed =new Array();//测风塔风速
    var title = new Array();//图例标题
    var windspeed_fix = new Array() //风速差值
    var arr =new Array();
    var forecastPower = new Array();//短期功率
    var weatherSpeed = new Array();//天气预报风速
    var rmseSpeed = new Array();//风速均方根误差
    var rmseSpeed_fix = new Array();//订正风速均方根误差
    var rmseVal = new Array()//风速均方根误差值
    var rmseVal_fix = new Array()//订正风速均方根误差值
    var farmid = $('#selectFarm', window.parent.document).val();//获取父页面的元素
    var height = $("#height option:checked").val();
    var tower = $("#tower option:checked").val();
    var p = {
        "startTime":$("#startTime").val(),
        "endTime":$("#endTime").val(),
        "farmid":farmid,
        "height":height,
        "towerid":tower,
    };

    $.ajax({
        url : "../windCurvesManage/selectOption",
        type : "get",
        contentType : "application/json",
        dataType : "json",
        data : p/*JSON.stringify(p)*/,//转换成字符串。后台使用了RequestBody注解
        success : function(data) {
            WfNwpSk = data.wfNwpsklist;
            WfMetSk = data.wfMetsklist;
            WfRmse = data.wfRmse;
            WfRmseVal = data.wfRmseVal;
            Fan = data.fan;
            rmseSpeed = WfRmse[0];
            rmseSpeed_fix = WfRmse[1];
            rmseVal = WfRmseVal[0];
            rmseVal_fix = WfRmseVal[1];

            //风电场天气预报风速遍历
            if(height == 10){
                $.each(WfNwpSk, function (index, item) {
                    var time = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm");
                    if(item.windspeed10!=null){
                        weatherSpeed.push({name:time,value:[time,item.windspeed10.toFixed(2)]});//天气风速
                    }
                });
                if(data.fan == 0){
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        if(item.height==10&&item.windspeed!=null){
                            speed.push({name:time,value:[time,item.windspeed.toFixed(2)]});//天气风速
                        }
                    });
                }else if(data.fan == 1){
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        speed.push({name:time,value:[time,item.speed.toFixed(2)]});//天气风速
                    });
                }


            } else if(height == 30){
                $.each(WfNwpSk, function (index, item) {
                    var time = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm");
                    if(item.windspeed30!=null){
                        weatherSpeed.push({name:time,value:[time,item.windspeed30.toFixed(2)]});//天气风速
                    }
                });
                if(data.fan == 0) {
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        if (item.height == 30 && item.windspeed != null) {
                            speed.push({name: time, value: [time, item.windspeed.toFixed(2)]});//天气风速
                        }
                    });
                }else if(data.fan == 1){
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        speed.push({name:time,value:[time,item.speed.toFixed(2)]});//天气风速
                    });
                }
            }else if(height == 50){
                $.each(WfNwpSk, function (index, item) {
                    var time = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm");
                    if(item.windspeed50!=null){
                        weatherSpeed.push({name:time,value:[time,item.windspeed50.toFixed(2)]});//天气风速
                    }
                });
                if(data.fan == 0) {
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        if (item.height == 50 && item.windspeed != null) {
                            speed.push({name: time, value: [time, item.windspeed.toFixed(2)]});//天气风速
                        }
                    });
                }else if(data.fan == 1){
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        speed.push({name:time,value:[time,item.speed.toFixed(2)]});//天气风速
                    });
                }
            }else if(height == 70){
                $.each(WfNwpSk, function (index, item) {
                    var time = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm");
                    if(item.windspeed!=null){
                        weatherSpeed.push({name:time,value:[time,item.windspeed.toFixed(2)]});//天气风速
                    }
                });
                if(data.fan == 0) {
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        if (item.height == 70 && item.windspeed != null) {
                            speed.push({name: time, value: [time, item.windspeed.toFixed(2)]});//天气风速
                        }
                    });
                }else if(data.fan == 1){
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        speed.push({name:time,value:[time,item.speed.toFixed(2)]});//天气风速
                    });
                }
            }else if(height == 80){
                $.each(WfNwpSk, function (index, item) {
                    var time = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm");
                    if(item.windspeed!=null){
                        weatherSpeed.push({name:time,value:[time,item.windspeed.toFixed(2)]});//天气风速
                    }
                });
                if(data.fan == 0) {
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        if (item.height == 80 && item.windspeed != null) {
                            speed.push({name: time, value: [time, item.windspeed.toFixed(2)]});//天气风速
                        }
                    });
                }else if(data.fan == 1){
                    $.each(WfMetSk, function (index, item) {
                        var time = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm");
                        speed.push({name:time,value:[time,item.speed.toFixed(2)]});//天气风速
                    });
                }
            }



            //添加天气预报的订正风速
            $.each(WfNwpSk, function (index, item) {
                var time = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm");
                if(item.windspeed_fix!=null){
                    windspeed_fix.push({name:time,value:[time,item.windspeed_fix.toFixed(2)]});//订正风速
                }
            });
            $("#windCurves").bootstrapTable("load", data.wfNwpsklist);

            lodaTu(date,title,speed,weatherSpeed,windspeed_fix);
            console.log(rmseSpeed);
            if(rmseVal == -1 && rmseVal_fix == -1){
                $("#result2").val("无数据");
                $("#precision2").val("无数据");
            }else if(rmseVal != -1 && rmseVal_fix == -1){
                var str1 = rmseVal.toFixed(2);
                str1+="m/s";
                $("#result2").val(str1);
                $("#precision2").val("无数据");
            }else if(rmseVal == -1 && rmseVal_fix != -1){
                $("#result2").val("无数据");
                var str2 = rmseVal_fix.toFixed(2);
                str2+="m/s";
                $("#precision2").val(str2);
            } else {
                /*var index1 = (rmseSpeed*100).toFixed(1);
                var index2 = (rmseSpeed_fix*100).toFixed(1);
                index1 += "%";
                index2 += "%";
                $("#result").val(index1);
                $("#precision").val(index2);*/
                var str1 = rmseVal.toFixed(2);
                var str2 = rmseVal_fix.toFixed(2);
                str1+="m/s";
                str2+="m/s";
                $("#result2").val(str1);
                $("#precision2").val(str2);
            }
            layer.close(index);
        },

    });

}

//表格工厂
function tableFactory(startTime,endTime,fileNames) {
    var me = this;
    me.data = null;//有功功率
    me.windData = null;//电站信息
    var init = function () {
        $.when(loadTower(me),loadHeight(me),me.getWindData()).then(function () {
            $("#windCurves").bootstrapTable({
                method: 'get',				  //请求方式（*）
                striped: true,					  //是否显示行间隔色
                cache: false,					   //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                pagination: true,				   //是否显示分页（*）
                sortable: true,					 //是否启用排序
                sortOrder: "desc",				   //排序方式
                sidePagination: "client",		   //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,					   //初始化加载第一页，默认第一页
                search: true,					   //是否显示表格搜索，只能进行客户端搜索
                strictSearch: false,                //true为全匹配，false为模糊查询
                showColumns: true,				  //是否显示筛选列按钮
                showRefresh: true,			  //是否显示刷新按钮
                clickToSelect:true,				//是否启用点击选中行
                showToggle: false,					//是否显示详细视图和列表视图的切换按钮
                cardView: false,					//是否显示详细视图
                detailView: false,				   //是否显示父子表
                singleSelect: true,                //是否支持多选,false表示支持多选，true表示不支持
                //undefinedText: '_',              //当数据为undefined时显示的字符
                height: 'auto',
                pageSize: 5,
                pageList: [5,20,30],
                editable:true,//是否可以行内编辑
                showExport: true,//是否显示导出按钮
                exportDataType:'all',//导出全部
                exportTypes:[  'csv'], //导出文件类型
                export: 'glyphicon-export icon-share',exportOptions:{
                    // ignoreColumn: [0,1],  //忽略某一列的索引
                    fileName:startTime+"_"+endTime+"_"+fileNames,  //文件名称设置
                    // worksheetName: 'sheet1',  //表格工作区名称
                    // tableName: '总台帐报表',
                    //  excelstyles: ['background-color', 'color', 'font-size', 'font-weight'],
                    // onMsoNumberFormat: DoOnMsoNumberFormat
                },
                columns: [{
                    title: '时间',
                    field: 'foretime',
                    sortable: true,//排序
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                        return new Date(parseInt(value)).Format("yyyy-MM-dd hh:mm");
                    }
                },
                    {
                    title: '测风塔风速(m/s)',
                    field: '',
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                        return me.getWfMetSkSpeed(row.foretime);
                    }
                }, {
                    title: '预报风速(m/s)',
                    field: '',
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                        return me.getWfNwpSpeed(row.foretime);
                    }
                },
                    {
                        title: '订正风速(m/s)',
                        field: '',
                        align: 'center',
                        valign: 'middle',
                        formatter: function (value, row, index) {
                            return me.getWfNwpWindspeed_fix(row.foretime);
                        }
                    }
                ],
                onEditableSave: function (field, row, oldValue, $el) {//编辑之后的事件
                    var p ={
                        id:row.fid,
                        power:row.power
                    }
                    $.ajax({
                        type: "post",
                        url: "../shortPeriodManage/edit",
                        data:p,//后台使用了实体类，前台就不能用Json.stringify
                        dataType: 'JSON',
                        success: function (data, status) {

                        },
                        error: function () {
                            alert('编辑失败');
                        },
                        complete: function () {

                        }
                    });
                }
            });
            //me.loadData();
            load();
        });
    }
    init();
}
tableFactory.prototype = {
    loadData: function () {
        var me = this;
        var index = layer.load(1);
        $.getJSON('../shortPeriodManage/selectAll', '', function (_data) {
            me.data = _data;
            $("#windCurves").bootstrapTable("load", _data);
            layer.close(index);
        })
    },
    //加载电站信息
    getWindData:function () {
        var me = this;
        $.getJSON('../windManage/selectAll', '', function (_data) {
            me.WindData = _data;
        })
    },
    getWindById: function (farmid) {
        var farmName = '';
        var me = this;
        $.each(me.WindData, function (index, item) {
            if (item.farmid === farmid) {
                farmName = item.farmname;
                return false;
            }
        });
        return farmName;
    },

    /*获取测风塔风速*/
    getWfMetSkSpeed:function (time) {
        var speed="";
        var height = $("#height option:checked").val();
        if(Fan == 0) {
            if (WfMetSk.length > 0) {
                if (height == 10) {
                    $.each(WfMetSk, function (index, item) {
                        var WfMetSkTime = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm")
                        if (WfMetSkTime == new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                            if (item.height == 10 && item.windspeed != null) {
                                speed = item.windspeed.toFixed(2);
                            } else {
                                speed = "-";
                            }
                            return false;
                        }
                    });
                } else if (height == 30) {
                    $.each(WfMetSk, function (index, item) {
                        var WfMetSkTime = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm")
                        if (WfMetSkTime == new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                            if (item.height == 30 && item.windspeed != null) {
                                speed = item.windspeed.toFixed(2);
                            } else {
                                speed = "-";
                            }
                            return false;
                        }
                    });
                } else if (height == 50) {
                    $.each(WfMetSk, function (index, item) {
                        var WfMetSkTime = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm")
                        if (WfMetSkTime == new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                            if (item.height == 50 && item.windspeed != null) {
                                speed = item.windspeed.toFixed(2);
                            } else {
                                speed = "-";
                            }
                            return false;
                        }
                    });
                } else if (height == 70) {
                    $.each(WfMetSk, function (index, item) {
                        var WfMetSkTime = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm")
                        if (WfMetSkTime == new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                            if (item.height == 70 && item.windspeed != null) {
                                speed = item.windspeed.toFixed(2);
                            } else {
                                speed = "-";
                            }
                            return false;
                        }
                    });
                } else if (height == 80) {
                    $.each(WfMetSk, function (index, item) {
                        var WfMetSkTime = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm")
                        if (WfMetSkTime == new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                            if (item.height == 80 && item.windspeed != null) {
                                speed = item.windspeed.toFixed(2);
                            } else {
                                speed = "-";
                            }
                            return false;
                        }
                    });
                }

                return speed;
            }
        }else if(Fan == 1){
            if(WfMetSk.length>0){
                $.each(WfMetSk, function (index, item) {
                    var WfMetSkTime = new Date(parseInt(item.observetime)).Format("yyyy-MM-dd hh:mm")
                    if(WfMetSkTime==new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                        speed = item.speed.toFixed(2);
                        return false;
                    }
                });
                return speed;
            }
        }
    },
    /*获取天气预报风速*/
    getWfNwpSpeed:function (time) {
        var speed="";
        var height = $("#height option:checked").val();
        if(WfNwpSk.length>0){
            if(height == 10){
                $.each(WfNwpSk, function (index, item) {
                    var WfNwpTime = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm")
                    if(WfNwpTime==new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                        if(item.windspeed10!=null){
                            speed = item.windspeed10.toFixed(2);
                        }else {
                            speed = "-";
                        }
                        return false;
                    }
                });
            }else if(height == 30){
                $.each(WfNwpSk, function (index, item) {
                    var WfNwpTime = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm")
                    if(WfNwpTime==new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                        if(item.windspeed30!=null){
                            speed = item.windspeed30.toFixed(2);
                        }else {
                            speed = "-";
                        }
                        return false;
                    }
                });
            }else if(height == 50){
                $.each(WfNwpSk, function (index, item) {
                    var WfNwpTime = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm")
                    if(WfNwpTime==new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                        if(item.windspeed50!=null){
                            speed = item.windspeed50.toFixed(2);
                        }else {
                            speed = "-";
                        }
                        return false;
                    }
                });
            }else if(height == 70||height == 80){
                $.each(WfNwpSk, function (index, item) {
                    var WfNwpTime = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm")
                    if(WfNwpTime==new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                        if(item.windspeed!=null){
                            speed = item.windspeed.toFixed(2);
                        }else {
                            speed = "-";
                        }
                        return false;
                    }
                });
            }

            return speed;
        }
    },

    /*获取天气预报订正风速*/
    getWfNwpWindspeed_fix:function (time) {
        var windspeed_fix="";
        if(WfNwpSk.length>0){
            $.each(WfNwpSk, function (index, item) {
                var WfNwpTime = new Date(parseInt(item.foretime)).Format("yyyy-MM-dd hh:mm")
                if(WfNwpTime==new Date(parseInt(time)).Format("yyyy-MM-dd hh:mm")) {
                    if(item.windspeed_fix!=null){
                        windspeed_fix = item.windspeed_fix.toFixed(2);
                    }else {
                        windspeed_fix = "-";
                    }
                    return false;
                }
            });
            return windspeed_fix;
        }
    }
}
//折线图 日期，实况功率，图例，实况风速，预报功率
function lodaTu(date,title,speed,weatherSpeed,windspeed_fix) {
    var myChart = echarts.init(document.getElementById("main"));
    //vapp.title = '多 X 轴示例';
    var colors = [ '#FFFF00','#FFFF00','#6eb2ff'];
    option = {
        // backgroundColor: '#071f3a',//背景色
        color: colors,
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            show:true,
            icon: 'rect',
            itemWidth: 25,
            itemHeight: 3,
            itemGap: 13,
            data: ['测风塔风速', '预报风速', '订正风速'],
            selected:{
                '订正风速':false,
            },
            textStyle: {
                fontSize: 12,
                fontWeight:'bolder',
                color: '#fff'
            }
            /*data: [
                {
                name:'测风塔风速',
                textStyle:{
                    fontSize:12,
                    fontWeight:'bolder',
                    color:'#fff'
                },

                //icon:'image://../img/legend/3.png'//格式为'image://+icon文件地址'，其中image::后的//不能省略
            },
                {
                    name:'天气预报风速',
                    textStyle:{
                        fontSize:12,
                        fontWeight:'bolder',
                        color:'#fff'
                    },
                    //icon:'image://../img/legend/2.png'//格式为'image://+icon文件地址'，其中image::后的//不能省略
                },
                {
                    name:'订正风速',
                    textStyle:{
                        fontSize:12,
                        fontWeight:'bolder',
                        color:'#fff'
                    },
                    //icon:'image://../img/legend/4.png'//格式为'image://+icon文件地址'，其中image::后的//不能省略
                }
            ],*/

        },
        toolbox: {
            show: true,
            feature: {
                /*mark: {show: true},
                dataZoom: {show: true},
                dataView: {show: true},
                magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                restore: {show: true},*/
                saveAsImage: {show: true}
            }
        },
        calculable: false,//取消拖拽
        dataZoom: {
            show: true,
            realtime: true,
            start: 0,
            end: 100
        },
        xAxis: [
            {
                //interval:0,//X轴的刻度间隔
                splitLine:{show: false},//去除网格线
                type: 'time',
                boundaryGap:true,
                //data: date,
                axisLabel:{
                    formatter: '{value}',
                    textStyle:{
                        fontWeight:"bolder",
                        color:"#fff"
                    }
                }
            }
        ],
        yAxis: [

            {
                splitLine:{show: false},//去除网格线
                name: '风速(m/s)',
                nameTextStyle:{
                    color:'#fff'
                },
                type: 'value',
                axisLabel:{
                    formatter: '{value}',
                    textStyle:{
                        fontWeight:"bolder",
                        color:"#fff"
                    }
                }
            }
        ],
        series: [
            {
                name: '测风塔风速',
                type: 'line',
                yAxisIndex: 0,
                symbol:'none',  //这句就是去掉点的
                data: speed,
                itemStyle: {
                    normal: {
                        color:'#A52A2A',
                    }
                },
            },{
                name: '预报风速',
                type: 'line',
                yAxisIndex: 0,
                symbol:'none',  //这句就是去掉点的
                data:weatherSpeed,
                itemStyle: {
                    normal: {
                        color:'#248f35',
                    }
                },
                /*itemStyle:{
                    normal:{
                        lineStyle:{
                            width:2,
                            //type:'dotted'dashed  //'dotted'虚线 'solid'实线
                            //color: '#3300FF',
                            type: 'dotted',
                            shadowBlur: 10,
                            shadowColor: 'rgba(0, 0, 0, 0.5)',
                            smooth:true,
                            width:2//线宽
                        }
                    }
                }*/
            },
            {
                name: '订正风速',
                type: 'line',
                yAxisIndex: 0,
                symbol:'none',  //这句就是去掉点的
                data: windspeed_fix,
                itemStyle: {
                    normal: {
                        color:'#4a6ab5',
                    }
                },
                /*itemStyle:{
                    normal:{
                        lineStyle:{
                            //width:2,
                            //type:'dotted'dashed  //'dotted'虚线 'solid'实线
                            //color: '#3300FF',
                            type: 'dotted',
                            shadowBlur: 10,
                            shadowColor: 'rgba(0, 0, 0, 0.5)',
                            smooth:true,
                            width:1//线宽
                        }
                    }
                }*/

            }

        ]
    };
    myChart.setOption(option);
}




